<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@page import="java.util.ArrayList"%>
<%@page import="dao.DataAccess"%>
<%@page import="bean.CompanyBean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>View Company</title>

<link
	href="<%=request.getContextPath()%>/CSS/ui-darkness/jquery-ui-1.9.2.custom.css"
	rel="stylesheet">
<script src="<%=request.getContextPath()%>/JS/jquery-1.8.3.js"></script>
<script src="<%=request.getContextPath()%>/JS/jquery-ui-1.9.2.custom.js"></script>
<script>
	$(function() {

		$("#accordion").accordion();
	});
</script>
<%
	ArrayList<CompanyBean> companyList = DataAccess
			.fetchCompanyDetails();
%>

</head>
<body>

	<table>
		<thead>
			<tr class="ui-widget-header ">
				<th>ID</th>
				<th>Name</th>
				<th>Phone</th>
				<th>Address</th>
				<th>Email</th>
				<th>Created On</th>
			</tr>
		</thead>
		<tbody>

			<%
				if (companyList != null) {
					for (int i = 0; i < companyList.size(); i++) {
						CompanyBean holderBean = companyList.get(i);
			%>
			<tr>
				<td><%=holderBean.getCompany_id()%></td>
				<td><%=holderBean.getName()%></td>
				<td><%=holderBean.getPhone()%></td>
				<td><%=holderBean.getAddress()%></td>
				<td><%=holderBean.getEmail()%></td>
				<td><%=holderBean.getCreated_on()%></td>
			</tr>

			<%
				}
				}
			%>

		</tbody>
	</table>

	<!-- Accordion -->
	<h2 class="demoHeaders">Company Details</h2>
	<div id="accordion">

		<%
			if (companyList != null) {
				for (int i = 0; i < companyList.size(); i++) {
					CompanyBean holderBean = companyList.get(i);
		%>
		<h3><%=holderBean.getName()%></h3>
		<div>
			<table>

				<thead>
					<tr class="ui-widget-header ">
						<th>ID</th>
						<th>Name</th>
						<th>Phone</th>
						<th>Address</th>
						<th>Email</th>
						<th>Created On</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td><%=holderBean.getCompany_id()%></td>
						<td><%=holderBean.getName()%></td>
						<td><%=holderBean.getPhone()%></td>
						<td><%=holderBean.getAddress()%></td>
						<td><%=holderBean.getEmail()%></td>
						<td><%=holderBean.getCreated_on()%></td>
					</tr>
				</tbody>
			</table>
		</div>

		<%
			}
			}
		%>
	</div>


</body>
</html>